{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from keras.models import Model\n",
    "from keras.layers import Input\n",
    "from keras.layers.convolutional import UpSampling2D\n",
    "from keras import backend as K\n",
    "import json\n",
    "from collections import OrderedDict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def format_decimal(arr, places=6):\n",
    "    return [round(x * 10**places) / 10**places for x in arr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "DATA = OrderedDict()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### UpSampling2D"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.UpSampling2D.0] size 2x2 upsampling on 3x3x3 input, data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (3, 3, 3)\n",
      "in: [-0.570441, -0.454673, -0.285321, 0.237249, 0.282682, 0.428035, 0.160547, -0.332203, 0.546391, 0.272735, 0.010827, -0.763164, -0.442696, 0.381948, -0.676994, 0.753553, -0.031788, 0.915329, -0.738844, 0.269075, 0.434091, 0.991585, -0.944288, 0.258834, 0.162138, 0.565201, -0.492094]\n",
      "out shape: (6, 6, 3)\n",
      "out: [-0.570441, -0.454673, -0.285321, -0.570441, -0.454673, -0.285321, 0.237249, 0.282682, 0.428035, 0.237249, 0.282682, 0.428035, 0.160547, -0.332203, 0.546391, 0.160547, -0.332203, 0.546391, -0.570441, -0.454673, -0.285321, -0.570441, -0.454673, -0.285321, 0.237249, 0.282682, 0.428035, 0.237249, 0.282682, 0.428035, 0.160547, -0.332203, 0.546391, 0.160547, -0.332203, 0.546391, 0.272735, 0.010827, -0.763164, 0.272735, 0.010827, -0.763164, -0.442696, 0.381948, -0.676994, -0.442696, 0.381948, -0.676994, 0.753553, -0.031788, 0.915329, 0.753553, -0.031788, 0.915329, 0.272735, 0.010827, -0.763164, 0.272735, 0.010827, -0.763164, -0.442696, 0.381948, -0.676994, -0.442696, 0.381948, -0.676994, 0.753553, -0.031788, 0.915329, 0.753553, -0.031788, 0.915329, -0.738844, 0.269075, 0.434091, -0.738844, 0.269075, 0.434091, 0.991585, -0.944288, 0.258834, 0.991585, -0.944288, 0.258834, 0.162138, 0.565201, -0.492094, 0.162138, 0.565201, -0.492094, -0.738844, 0.269075, 0.434091, -0.738844, 0.269075, 0.434091, 0.991585, -0.944288, 0.258834, 0.991585, -0.944288, 0.258834, 0.162138, 0.565201, -0.492094, 0.162138, 0.565201, -0.492094]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (3, 3, 3)\n",
    "L = UpSampling2D(size=(2, 2), data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(250)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.UpSampling2D.0'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.UpSampling2D.1] size 2x2 upsampling on 3x3x3 input, data_format='channels_first'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (3, 3, 3)\n",
      "in: [0.275222, -0.793967, -0.468107, -0.841484, -0.295362, 0.78175, 0.068787, -0.261747, -0.625733, -0.042907, 0.861141, 0.85267, 0.956439, 0.717838, -0.99869, -0.963008, 0.013277, -0.180306, 0.832137, -0.385252, -0.524308, 0.659706, -0.905127, 0.526292, 0.832569, 0.084455, 0.23838]\n",
      "out shape: (3, 6, 6)\n",
      "out: [0.275222, 0.275222, -0.793967, -0.793967, -0.468107, -0.468107, 0.275222, 0.275222, -0.793967, -0.793967, -0.468107, -0.468107, -0.841484, -0.841484, -0.295362, -0.295362, 0.78175, 0.78175, -0.841484, -0.841484, -0.295362, -0.295362, 0.78175, 0.78175, 0.068787, 0.068787, -0.261747, -0.261747, -0.625733, -0.625733, 0.068787, 0.068787, -0.261747, -0.261747, -0.625733, -0.625733, -0.042907, -0.042907, 0.861141, 0.861141, 0.85267, 0.85267, -0.042907, -0.042907, 0.861141, 0.861141, 0.85267, 0.85267, 0.956439, 0.956439, 0.717838, 0.717838, -0.99869, -0.99869, 0.956439, 0.956439, 0.717838, 0.717838, -0.99869, -0.99869, -0.963008, -0.963008, 0.013277, 0.013277, -0.180306, -0.180306, -0.963008, -0.963008, 0.013277, 0.013277, -0.180306, -0.180306, 0.832137, 0.832137, -0.385252, -0.385252, -0.524308, -0.524308, 0.832137, 0.832137, -0.385252, -0.385252, -0.524308, -0.524308, 0.659706, 0.659706, -0.905127, -0.905127, 0.526292, 0.526292, 0.659706, 0.659706, -0.905127, -0.905127, 0.526292, 0.526292, 0.832569, 0.832569, 0.084455, 0.084455, 0.23838, 0.23838, 0.832569, 0.832569, 0.084455, 0.084455, 0.23838, 0.23838]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (3, 3, 3)\n",
    "L = UpSampling2D(size=(2, 2), data_format='channels_first')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(251)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.UpSampling2D.1'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.UpSampling2D.2] size 3x2 upsampling on 4x2x2 input, data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (4, 2, 2)\n",
      "in: [-0.989173, -0.133618, -0.505338, 0.023259, 0.503982, -0.303769, -0.436321, 0.793911, 0.416102, 0.806405, -0.098342, -0.738022, -0.982676, 0.805073, 0.741244, -0.941634]\n",
      "out shape: (12, 4, 2)\n",
      "out: [-0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, -0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, -0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, 0.503982, -0.303769, 0.503982, -0.303769, -0.436321, 0.793911, -0.436321, 0.793911, 0.503982, -0.303769, 0.503982, -0.303769, -0.436321, 0.793911, -0.436321, 0.793911, 0.503982, -0.303769, 0.503982, -0.303769, -0.436321, 0.793911, -0.436321, 0.793911, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022, -0.982676, 0.805073, -0.982676, 0.805073, 0.741244, -0.941634, 0.741244, -0.941634, -0.982676, 0.805073, -0.982676, 0.805073, 0.741244, -0.941634, 0.741244, -0.941634, -0.982676, 0.805073, -0.982676, 0.805073, 0.741244, -0.941634, 0.741244, -0.941634]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (4, 2, 2)\n",
    "L = UpSampling2D(size=(3, 2), data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(252)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.UpSampling2D.2'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.UpSampling2D.3] size 1x3 upsampling on 4x3x2 input, data_format='channels_first'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (4, 3, 2)\n",
      "in: [-0.47588, 0.366985, 0.040173, 0.015578, -0.906159, 0.241982, -0.771299, -0.443554, -0.56404, -0.17751, 0.541277, -0.233327, 0.024369, 0.858275, 0.496191, 0.980574, -0.59522, 0.480899, 0.392553, -0.191718, 0.055121, 0.289836, -0.498339, 0.800408]\n",
      "out shape: (4, 3, 6)\n",
      "out: [-0.47588, -0.47588, -0.47588, 0.366985, 0.366985, 0.366985, 0.040173, 0.040173, 0.040173, 0.015578, 0.015578, 0.015578, -0.906159, -0.906159, -0.906159, 0.241982, 0.241982, 0.241982, -0.771299, -0.771299, -0.771299, -0.443554, -0.443554, -0.443554, -0.56404, -0.56404, -0.56404, -0.17751, -0.17751, -0.17751, 0.541277, 0.541277, 0.541277, -0.233327, -0.233327, -0.233327, 0.024369, 0.024369, 0.024369, 0.858275, 0.858275, 0.858275, 0.496191, 0.496191, 0.496191, 0.980574, 0.980574, 0.980574, -0.59522, -0.59522, -0.59522, 0.480899, 0.480899, 0.480899, 0.392553, 0.392553, 0.392553, -0.191718, -0.191718, -0.191718, 0.055121, 0.055121, 0.055121, 0.289836, 0.289836, 0.289836, -0.498339, -0.498339, -0.498339, 0.800408, 0.800408, 0.800408]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (4, 3, 2)\n",
    "L = UpSampling2D(size=(1, 3), data_format='channels_first')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(253)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.UpSampling2D.3'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.UpSampling2D.4] size 2 upsampling on 1x3x2 input, data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (1, 3, 2)\n",
      "in: [0.024124, 0.280236, -0.680013, -0.042458, -0.164273, 0.358409]\n",
      "out shape: (2, 6, 2)\n",
      "out: [0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409, 0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (1, 3, 2)\n",
    "L = UpSampling2D(size=2, data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(254)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.UpSampling2D.4'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### export for Keras.js tests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "filename = '../../../test/data/layers/convolutional/UpSampling2D.json'\n",
    "if not os.path.exists(os.path.dirname(filename)):\n",
    "    os.makedirs(os.path.dirname(filename))\n",
    "with open(filename, 'w') as f:\n",
    "    json.dump(DATA, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"convolutional.UpSampling2D.0\": {\"input\": {\"data\": [-0.570441, -0.454673, -0.285321, 0.237249, 0.282682, 0.428035, 0.160547, -0.332203, 0.546391, 0.272735, 0.010827, -0.763164, -0.442696, 0.381948, -0.676994, 0.753553, -0.031788, 0.915329, -0.738844, 0.269075, 0.434091, 0.991585, -0.944288, 0.258834, 0.162138, 0.565201, -0.492094], \"shape\": [3, 3, 3]}, \"expected\": {\"data\": [-0.570441, -0.454673, -0.285321, -0.570441, -0.454673, -0.285321, 0.237249, 0.282682, 0.428035, 0.237249, 0.282682, 0.428035, 0.160547, -0.332203, 0.546391, 0.160547, -0.332203, 0.546391, -0.570441, -0.454673, -0.285321, -0.570441, -0.454673, -0.285321, 0.237249, 0.282682, 0.428035, 0.237249, 0.282682, 0.428035, 0.160547, -0.332203, 0.546391, 0.160547, -0.332203, 0.546391, 0.272735, 0.010827, -0.763164, 0.272735, 0.010827, -0.763164, -0.442696, 0.381948, -0.676994, -0.442696, 0.381948, -0.676994, 0.753553, -0.031788, 0.915329, 0.753553, -0.031788, 0.915329, 0.272735, 0.010827, -0.763164, 0.272735, 0.010827, -0.763164, -0.442696, 0.381948, -0.676994, -0.442696, 0.381948, -0.676994, 0.753553, -0.031788, 0.915329, 0.753553, -0.031788, 0.915329, -0.738844, 0.269075, 0.434091, -0.738844, 0.269075, 0.434091, 0.991585, -0.944288, 0.258834, 0.991585, -0.944288, 0.258834, 0.162138, 0.565201, -0.492094, 0.162138, 0.565201, -0.492094, -0.738844, 0.269075, 0.434091, -0.738844, 0.269075, 0.434091, 0.991585, -0.944288, 0.258834, 0.991585, -0.944288, 0.258834, 0.162138, 0.565201, -0.492094, 0.162138, 0.565201, -0.492094], \"shape\": [6, 6, 3]}}, \"convolutional.UpSampling2D.1\": {\"input\": {\"data\": [0.275222, -0.793967, -0.468107, -0.841484, -0.295362, 0.78175, 0.068787, -0.261747, -0.625733, -0.042907, 0.861141, 0.85267, 0.956439, 0.717838, -0.99869, -0.963008, 0.013277, -0.180306, 0.832137, -0.385252, -0.524308, 0.659706, -0.905127, 0.526292, 0.832569, 0.084455, 0.23838], \"shape\": [3, 3, 3]}, \"expected\": {\"data\": [0.275222, 0.275222, -0.793967, -0.793967, -0.468107, -0.468107, 0.275222, 0.275222, -0.793967, -0.793967, -0.468107, -0.468107, -0.841484, -0.841484, -0.295362, -0.295362, 0.78175, 0.78175, -0.841484, -0.841484, -0.295362, -0.295362, 0.78175, 0.78175, 0.068787, 0.068787, -0.261747, -0.261747, -0.625733, -0.625733, 0.068787, 0.068787, -0.261747, -0.261747, -0.625733, -0.625733, -0.042907, -0.042907, 0.861141, 0.861141, 0.85267, 0.85267, -0.042907, -0.042907, 0.861141, 0.861141, 0.85267, 0.85267, 0.956439, 0.956439, 0.717838, 0.717838, -0.99869, -0.99869, 0.956439, 0.956439, 0.717838, 0.717838, -0.99869, -0.99869, -0.963008, -0.963008, 0.013277, 0.013277, -0.180306, -0.180306, -0.963008, -0.963008, 0.013277, 0.013277, -0.180306, -0.180306, 0.832137, 0.832137, -0.385252, -0.385252, -0.524308, -0.524308, 0.832137, 0.832137, -0.385252, -0.385252, -0.524308, -0.524308, 0.659706, 0.659706, -0.905127, -0.905127, 0.526292, 0.526292, 0.659706, 0.659706, -0.905127, -0.905127, 0.526292, 0.526292, 0.832569, 0.832569, 0.084455, 0.084455, 0.23838, 0.23838, 0.832569, 0.832569, 0.084455, 0.084455, 0.23838, 0.23838], \"shape\": [3, 6, 6]}}, \"convolutional.UpSampling2D.2\": {\"input\": {\"data\": [-0.989173, -0.133618, -0.505338, 0.023259, 0.503982, -0.303769, -0.436321, 0.793911, 0.416102, 0.806405, -0.098342, -0.738022, -0.982676, 0.805073, 0.741244, -0.941634], \"shape\": [4, 2, 2]}, \"expected\": {\"data\": [-0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, -0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, -0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, 0.503982, -0.303769, 0.503982, -0.303769, -0.436321, 0.793911, -0.436321, 0.793911, 0.503982, -0.303769, 0.503982, -0.303769, -0.436321, 0.793911, -0.436321, 0.793911, 0.503982, -0.303769, 0.503982, -0.303769, -0.436321, 0.793911, -0.436321, 0.793911, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022, -0.982676, 0.805073, -0.982676, 0.805073, 0.741244, -0.941634, 0.741244, -0.941634, -0.982676, 0.805073, -0.982676, 0.805073, 0.741244, -0.941634, 0.741244, -0.941634, -0.982676, 0.805073, -0.982676, 0.805073, 0.741244, -0.941634, 0.741244, -0.941634], \"shape\": [12, 4, 2]}}, \"convolutional.UpSampling2D.3\": {\"input\": {\"data\": [-0.47588, 0.366985, 0.040173, 0.015578, -0.906159, 0.241982, -0.771299, -0.443554, -0.56404, -0.17751, 0.541277, -0.233327, 0.024369, 0.858275, 0.496191, 0.980574, -0.59522, 0.480899, 0.392553, -0.191718, 0.055121, 0.289836, -0.498339, 0.800408], \"shape\": [4, 3, 2]}, \"expected\": {\"data\": [-0.47588, -0.47588, -0.47588, 0.366985, 0.366985, 0.366985, 0.040173, 0.040173, 0.040173, 0.015578, 0.015578, 0.015578, -0.906159, -0.906159, -0.906159, 0.241982, 0.241982, 0.241982, -0.771299, -0.771299, -0.771299, -0.443554, -0.443554, -0.443554, -0.56404, -0.56404, -0.56404, -0.17751, -0.17751, -0.17751, 0.541277, 0.541277, 0.541277, -0.233327, -0.233327, -0.233327, 0.024369, 0.024369, 0.024369, 0.858275, 0.858275, 0.858275, 0.496191, 0.496191, 0.496191, 0.980574, 0.980574, 0.980574, -0.59522, -0.59522, -0.59522, 0.480899, 0.480899, 0.480899, 0.392553, 0.392553, 0.392553, -0.191718, -0.191718, -0.191718, 0.055121, 0.055121, 0.055121, 0.289836, 0.289836, 0.289836, -0.498339, -0.498339, -0.498339, 0.800408, 0.800408, 0.800408], \"shape\": [4, 3, 6]}}, \"convolutional.UpSampling2D.4\": {\"input\": {\"data\": [0.024124, 0.280236, -0.680013, -0.042458, -0.164273, 0.358409], \"shape\": [1, 3, 2]}, \"expected\": {\"data\": [0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409, 0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409], \"shape\": [2, 6, 2]}}}\n"
     ]
    }
   ],
   "source": [
    "print(json.dumps(DATA))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
